<%--
  Created by IntelliJ IDEA.
  User: 74018
  Date: 2018/12/30
  Time: 11:17
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>车辆进货</title>
    <jsp:include page="${pageContext.request.contextPath}/common/common.jsp"/>
</head>
<body>
    <table id="myTb"></table>

<div id="myForm" class="container">
    <form action="#" id="form111" class="form-inline">
        <div class="form-group">
            <div class="form-group col-sm-3">
                <input type="text" class="form-control" name="minPrice" placeholder="最低价">
            </div>
            <div class="form-group col-sm-3">
                <input type="text" name="maxPrice" class="form-control" placeholder="最高价">
            </div>
            <div class="form-group col-sm-3">
                <input type="text" class="form-control" name="color" placeholder="颜色">
            </div>

            <div class="form-group col-sm-3">
                <div class="input-group date" id="datetimepicker">
                    <input class="form-control" id="minDate" type="text" name="minDate" placeholder="时间" />
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>
            <div class="form-group col-sm-3">
                <input type="text" class="form-control input-group-btn" name="brand" placeholder="品牌">
            </div>

            <div class="form-group col-sm-3">
                <input type="text" class="form-control" name="minPrice" placeholder="供货商">
            </div>
            <div class="form-group col-sm-3">
                <input type="text" name="maxPrice" class="form-control" placeholder="处理人">
            </div>
            <div class="form-group col-sm-3">
                <div class="input-group date" id="datetimepicker1">
                    <input class="form-control" id="maxDate" type="text" name="maxDate" placeholder="时间" />
                    <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                </div>
            </div>

            <div class="form-group col-sm-3">
                <input type="text" class="form-control" name="level" placeholder="车辆配置">
            </div>
        </div>
        <div class="form-group">
            <div class="form-group col-sm-3">

                <button type="button" class="btn btn-primary" onclick="search();"><i class="glyphicon glyphicon-search"></i>&nbsp;搜索</button>
            </div>
        </div>
    </form>
</div>


</body>
</html>
<script>
    $(function () {

        $('.date').datepicker({
            format: 'yyyy-mm-dd',
            locale: moment.locale('zh-cn')
        });

        $("#myTb").bootstrapTable({
            url:"${pageContext.request.contextPath}/carpurchase/query",
            toolbar: '#myForm',//工具按钮用哪个容器
            striped: true,//隔行换色
            search: false,
            //showRefresh: true,//是否显示刷新按钮
            height: 480,//行高，如果没有设置height属性，表格自动根据记录条数觉得表格高度
            uniqueId: "id",//每一行的唯一标识，一般为主键列
            //showToggle:true,//是否显示详细视图和列表视图的切换按钮
            //detailView:true,//是否显示父子表
            clickToSelect: true,
            pagination:true, //是否显示分页（*）
            pageSize : 5,//单页记录数
            pageList : [5, 10],//可选择单页记录数
            columns : [
                {
                    checkbox: true
                }, {
                    field: "id",
                    title: '编号'
                },{
                    field: 'brand',
                    title: '车辆品牌'
                }, {
                    field: 'model',
                    title: '车型'
                },{
                    field:'level',
                    title:'车辆配置'
                },{
                    field:'color',
                    title:'车辆颜色'
                },{
                    field:'price',
                    title:'车辆价格'
                },{
                    field:'count',
                    title:'车辆数量'
                },{
                    field:'userInfo.workname',
                    title:'处理员工'
                },{
                    field:'supplier2.name',
                    title:'供应商'
                },{
                    field:'date',
                    title:'时间'
                },{
                    field:'note',
                    title:'备注'
                }]
        })

    });

    function search(){
        var formStr = $("#form111").serialize();
        var mydata = decodeURIComponent(formStr,true);
        console.log(mydata);
        $.ajax({
            url:"${pageContext.request.contextPath}/carpurchase/query",
            data:mydata,
            success:function (data) {
                $("#myTb").bootstrapTable("load",data);
            }
        })
    }

</script>
